<!DOCTYPE html>
<html lang="en">
<head>

	<meta charset="utf-8">
	<title>Delete Resident</title>
	<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>/application/css/style.css" />
	<link rel="stylesheet" href="<?php echo base_url();?>/application/development-bundle/themes/custom-theme/jquery.ui.all.css">
	<script src="<?php echo base_url();?>/application/development-bundle/jquery-1.4.4.js"></script>
	<script src="<?php echo base_url();?>/application/development-bundle/external/jquery.bgiframe-2.1.1.js"></script>
	<script src="<?php echo base_url();?>/application/development-bundle/ui/jquery.ui.core.js"></script>
	<script src="<?php echo base_url();?>/application/development-bundle/ui/jquery.ui.widget.js"></script>
	<script src="<?php echo base_url();?>/application/development-bundle/ui/jquery.ui.accordion.js"></script>
	<script src="<?php echo base_url();?>/application/development-bundle/ui/jquery.ui.mouse.js"></script>
	<script src="<?php echo base_url();?>/application/development-bundle/ui/jquery.ui.button.js"></script>
	<script src="<?php echo base_url();?>/application/development-bundle/ui/jquery.ui.draggable.js"></script>
	<script src="<?php echo base_url();?>/application/development-bundle/ui/jquery.ui.position.js"></script>
	<script src="<?php echo base_url();?>/application/development-bundle/ui/jquery.ui.resizable.js"></script>
	<script src="<?php echo base_url();?>/application/development-bundle/ui/jquery.ui.dialog.js"></script>
	<script src="<?php echo base_url();?>/application/development-bundle/ui/jquery.effects.core.js"></script>
	<link rel="stylesheet" href="<?php echo base_url();?>/application/development-bundle/demos/demos.css">
	
	<style>
		fieldset { padding:0; border:0; margin-top:25px; }
		h1 { font-size: 1.2em; margin: .6em 0; }
		div#users-contain { width: 350px; margin: 20px 0; }
		div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
		div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
		#accordion {width: 420px;}
	</style>
	
	<script>
	$(function() {
		$( "#accordion" ).accordion({
			autoHeight: false,
			navigation: true,
			collapsible: true
		});
	});
	</script>
	
	<script type="text/javascript" language="JavaScript">
	function OnSubmitForm(){
		if(document.pressed == "Delete Resident"){
			if(document.adminform.delete[0].checked==false){
				choice=confirm("Are you sure?");
				if(choice==true){
					document.adminform.action ="<?php echo base_url();?>/index.php/residentController/deleteResident";
					return true;
				}else return false;
			}else{
				alert("Must choose a resident to delete!");
				return false;
			}
		
		}else if(document.pressed == "Main Menu"){
			document.adminform.action ="<?php echo base_url();?>/index.php/adminPageController";
			return true;
		}
	}
	</script>
	
</head>

<body>

<div class="demo">

	<div id="header"><h2>ACCI eXtreme Information System</h2></div>
	
	<div id="accordion">
	
		<h2><a href="#section1">Delete a Resident</a></h2>
		<form name="adminform" method="post" onSubmit="return OnSubmitForm();">
			<div>
			<div id="users-contain" class="ui-widget">
				<h3>Existing Resident(s):</h3>
				<table id="users" class="ui-widget ui-widget-content">
					<thead>
						<tr class="ui-widget-header ">
							<th>Delete</th>
							<th>Student Number</th>
							<th>Name</th>
						</tr>
					</thead>
					<tbody>
						<tr><td><input type="radio" name="delete" value="none" checked="checked"></td><td>None</td><td></td></tr>
						<?php foreach($data->result() as $row):?>
						<tr>
							<td><input type="radio" name="delete" value="<?php echo $row->student_number;?>"/></td>
							<td><?php echo $row->student_number;?></td>
							<td><?php echo $row->first_name.' ';echo $row->middle_name.' ';echo $row->last_name;?></td>
						</tr>
						<?php endforeach;?>
					</tbody>
				</table>
				
			</div>
			<input type="reset"/>
			<input type="submit" value="Delete Resident" onClick="document.pressed=this.value"/>
			<input type="submit" value="Main Menu" onClick="document.pressed=this.value"/>
			</div>
		</form>
		
	</div><!-- End accordion -->
	
</div><!-- End demo -->

</body>
</html>